package com.NHL.modules.mc
{
	import com.NHL.modules.mc.animation.McAnimation;
	import com.NHL.modules.mc.vo.CharactorVo;
	
	import flash.display.MovieClip;
	import flash.geom.Point;
	
	public class Charactor
	{
		private var _speed:Number;
		private var _vo:CharactorVo;
		private var _destPoint:Point;
		private var _anmination:McAnimation;
		private var _invert:Boolean;
		private var _actType:String;
		public function Charactor(vo:CharactorVo= null)
		{
			super();
			if(vo)
			{
				_vo = vo;
				initMc(_vo);
			}
		}
		
		public function get anmination():McAnimation
		{
			return _anmination;
		}

		public function set anmination(value:McAnimation):void
		{
			_anmination = value;
		}

		protected function initMc(vo:CharactorVo):void
		{
			_vo = vo;
			_anmination = new McAnimation(_vo.classId);
			
			
		}
		
		public function goToPoint(point:Point):void
		{
			_destPoint = point;
		}
		
		public function update():void
		{
			
			var actType:String;
			var actDir:String
			//actType = 
			var radios:int = getRadios(new Point());
			_invert = false;
			switch(radios)
			{
				case 0:
					actDir = "R";
					//_invert
					break;
				case 45:
					actDir = "RU";
					break;
				case 90:
					actDir = "U";
					break;
				case 135:
					actDir = "RU";
					_invert = true;
					break;
				case 180:
					_invert = true;
					actDir = "R";
					break;
				case 225:
					actDir = "RD"
					//_invert = true;
					break;
				case 270:
					actDir = "U";
					_invert = true;
					break;
				case 315:
					actDir = "RD";
					_invert = true;
					break;
				
				
			}
		//	_vo.actType= actType + actDir;
			_anmination.actType = actType +　actDir
			updateFrame();
			updatePostion();
		}
		
		private function getRadios(point:Point):int
		{
		   	return Math.atan2(point.y - this._anmination.y,point.x - this._anmination.x);
			
		}
		
		private function updateFrame():void
		{
				
		}
		
		private function updatePostion():void
		{
			
		}
	}
}